const mongoose = require('mongoose')

const schema = new mongoose.Schema({
  merchandise: { type: mongoose.SchemaTypes.ObjectId, ref: 'Merchandise', unique: true  }, // 商品
  detail: [{
    isGood: { type: Boolean },
    buyer: { type: mongoose.SchemaTypes.ObjectId, ref: 'Buyer' }, // 买家
    comment: { type: String },
    img: { type: String },
    color: { type: String },
    size: { type: String },
    star: { type: Number }
  }]

})

module.exports = mongoose.model('Comment', schema)